package top.martinzh.stock.manager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import top.martinzh.stock.entity.Company;

/**
 * 证券交易所管理
 * @author martin
 *
 */
@Service
public class StockExchangeManager {
	
	@Autowired
	private CompanyManager companyManager;

	@Autowired
	private TradeManager tradeManager;

	/**
	 * 公司上市
	 * @param company
	 */
	public Company goPublic(String name, double issuePrice, int amount) {
		return companyManager.add(name, issuePrice, amount);
	}
	
	/**
	 * 买股票
	 * @param code 股票代码
	 * @param price 股票价格
	 * @param amount 交易数量
	 */
	public void buy(String code, double price, int amount) {
		
		tradeManager.buy(code, price, amount);
		
	}
	
	/**
	 * 卖股票
	 * @param code 股票代码
	 * @param price 股票价格
	 * @param amount 交易数量
	 */
	public void sell(String code, double price, int amount) {

		tradeManager.sell(code, price, amount);
		
	}
	
}
